using Microsoft.Win32;
using System;
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace TVSGPP.tools
{
	public class frmAppOptionMain : Form
	{
		private IContainer components = null;
		private CheckBox ckbOppLeftMenu;
		private Label label1;
		private Label label3;
		private CheckBox cbkRetailDoctor;
		private CheckBox cbkOutput;
		private CheckBox cbkRetail;
		private CheckBox cbkBalancer;
		private CheckBox cbkBill;
		private CheckBox cbkInput;
		private CheckBox cbkOutputDelete;
		private CheckBox cbkExpire;
		private Button btnSave;
		public GroupBox grB1;
		public GroupBox grB2;
		private Label label2;
		protected override void Dispose(bool disposing)
		{
			if (disposing && this.components != null)
			{
				this.components.Dispose();
			}
			base.Dispose(disposing);
		}
		private void InitializeComponent()
		{
			this.ckbOppLeftMenu = new CheckBox();
			this.grB1 = new GroupBox();
			this.label1 = new Label();
			this.grB2 = new GroupBox();
			this.label2 = new Label();
			this.cbkOutputDelete = new CheckBox();
			this.cbkExpire = new CheckBox();
			this.cbkBalancer = new CheckBox();
			this.cbkBill = new CheckBox();
			this.cbkInput = new CheckBox();
			this.cbkOutput = new CheckBox();
			this.cbkRetail = new CheckBox();
			this.cbkRetailDoctor = new CheckBox();
			this.label3 = new Label();
			this.btnSave = new Button();
			this.grB1.SuspendLayout();
			this.grB2.SuspendLayout();
			base.SuspendLayout();
			this.ckbOppLeftMenu.AutoSize = true;
			this.ckbOppLeftMenu.Font = new Font("Arial", 9f);
			this.ckbOppLeftMenu.Location = new Point(18, 20);
			this.ckbOppLeftMenu.Name = "ckbOppLeftMenu";
			this.ckbOppLeftMenu.Size = new Size(80, 19);
			this.ckbOppLeftMenu.TabIndex = 1;
			this.ckbOppLeftMenu.Text = "Mở / đóng";
			this.ckbOppLeftMenu.UseVisualStyleBackColor = true;
			this.grB1.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.grB1.Controls.Add(this.label1);
			this.grB1.Controls.Add(this.ckbOppLeftMenu);
			this.grB1.Enabled = false;
			this.grB1.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.grB1.Location = new Point(12, 7);
			this.grB1.Name = "grB1";
			this.grB1.Size = new Size(375, 91);
			this.grB1.TabIndex = 0;
			this.grB1.TabStop = false;
			this.grB1.Text = "Thanh công cụ bên phải giao diện";
			this.label1.AutoSize = true;
			this.label1.Font = new Font("Arial", 9f);
			this.label1.Location = new Point(74, 59);
			this.label1.Name = "label1";
			this.label1.Size = new Size(181, 15);
			this.label1.TabIndex = 1;
			this.label1.Text = "Check là mở - Bỏ check là đóng";
			this.grB2.Anchor = (AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right);
			this.grB2.Controls.Add(this.label2);
			this.grB2.Controls.Add(this.cbkOutputDelete);
			this.grB2.Controls.Add(this.cbkExpire);
			this.grB2.Controls.Add(this.cbkBalancer);
			this.grB2.Controls.Add(this.cbkBill);
			this.grB2.Controls.Add(this.cbkInput);
			this.grB2.Controls.Add(this.cbkOutput);
			this.grB2.Controls.Add(this.cbkRetail);
			this.grB2.Controls.Add(this.cbkRetailDoctor);
			this.grB2.Enabled = false;
			this.grB2.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.grB2.Location = new Point(12, 99);
			this.grB2.Name = "grB2";
			this.grB2.Size = new Size(375, 282);
			this.grB2.TabIndex = 2;
			this.grB2.TabStop = false;
			this.grB2.Text = "Thanh công cụ bên phải giao diện";
			this.label2.AutoSize = true;
			this.label2.Font = new Font("Arial", 9f);
			this.label2.Location = new Point(74, 248);
			this.label2.Name = "label2";
			this.label2.Size = new Size(181, 15);
			this.label2.TabIndex = 11;
			this.label2.Text = "Check là mở - Bỏ check là đóng";
			this.cbkOutputDelete.AutoSize = true;
			this.cbkOutputDelete.Font = new Font("Arial", 9f);
			this.cbkOutputDelete.Location = new Point(18, 206);
			this.cbkOutputDelete.Name = "cbkOutputDelete";
			this.cbkOutputDelete.Size = new Size(78, 19);
			this.cbkOutputDelete.TabIndex = 10;
			this.cbkOutputDelete.Text = "Huỷ hàng";
			this.cbkOutputDelete.UseVisualStyleBackColor = true;
			this.cbkExpire.AutoSize = true;
			this.cbkExpire.Font = new Font("Arial", 9f);
			this.cbkExpire.Location = new Point(18, 180);
			this.cbkExpire.Name = "cbkExpire";
			this.cbkExpire.Size = new Size(98, 19);
			this.cbkExpire.TabIndex = 9;
			this.cbkExpire.Text = "Hạn sử dụng";
			this.cbkExpire.UseVisualStyleBackColor = true;
			this.cbkBalancer.AutoSize = true;
			this.cbkBalancer.Font = new Font("Arial", 9f);
			this.cbkBalancer.Location = new Point(18, 154);
			this.cbkBalancer.Name = "cbkBalancer";
			this.cbkBalancer.Size = new Size(76, 19);
			this.cbkBalancer.TabIndex = 8;
			this.cbkBalancer.Text = "Hàng tồn";
			this.cbkBalancer.UseVisualStyleBackColor = true;
			this.cbkBill.AutoSize = true;
			this.cbkBill.Font = new Font("Arial", 9f);
			this.cbkBill.Location = new Point(18, 128);
			this.cbkBill.Name = "cbkBill";
			this.cbkBill.Size = new Size(74, 19);
			this.cbkBill.TabIndex = 7;
			this.cbkBill.Text = "Hoá đơn";
			this.cbkBill.UseVisualStyleBackColor = true;
			this.cbkInput.AutoSize = true;
			this.cbkInput.Font = new Font("Arial", 9f);
			this.cbkInput.Location = new Point(18, 102);
			this.cbkInput.Name = "cbkInput";
			this.cbkInput.Size = new Size(87, 19);
			this.cbkInput.TabIndex = 6;
			this.cbkInput.Text = "Nhập hàng";
			this.cbkInput.UseVisualStyleBackColor = true;
			this.cbkOutput.AutoSize = true;
			this.cbkOutput.Font = new Font("Arial", 9f);
			this.cbkOutput.Location = new Point(18, 76);
			this.cbkOutput.Name = "cbkOutput";
			this.cbkOutput.Size = new Size(79, 19);
			this.cbkOutput.TabIndex = 5;
			this.cbkOutput.Text = "Bán buôn";
			this.cbkOutput.UseVisualStyleBackColor = true;
			this.cbkRetail.AutoSize = true;
			this.cbkRetail.Font = new Font("Arial", 9f);
			this.cbkRetail.Location = new Point(18, 50);
			this.cbkRetail.Name = "cbkRetail";
			this.cbkRetail.Size = new Size(61, 19);
			this.cbkRetail.TabIndex = 4;
			this.cbkRetail.Text = "Bán lẻ";
			this.cbkRetail.UseVisualStyleBackColor = true;
			this.cbkRetailDoctor.AutoSize = true;
			this.cbkRetailDoctor.Font = new Font("Arial", 9f);
			this.cbkRetailDoctor.Location = new Point(18, 24);
			this.cbkRetailDoctor.Name = "cbkRetailDoctor";
			this.cbkRetailDoctor.Size = new Size(100, 19);
			this.cbkRetailDoctor.TabIndex = 3;
			this.cbkRetailDoctor.Text = "Bán theo đơn";
			this.cbkRetailDoctor.UseVisualStyleBackColor = true;
			this.label3.AutoSize = true;
			this.label3.Location = new Point(108, 395);
			this.label3.Name = "label3";
			this.label3.Size = new Size(231, 15);
			this.label3.TabIndex = 2;
			this.label3.Text = "Yêu cầu phải khởi động lại chương trình !";
			this.btnSave.Cursor = Cursors.Hand;
			this.btnSave.Font = new Font("Arial", 9f, FontStyle.Bold, GraphicsUnit.Point, 163);
			this.btnSave.Location = new Point(12, 387);
			this.btnSave.Name = "btnSave";
			this.btnSave.Size = new Size(90, 30);
			this.btnSave.TabIndex = 11;
			this.btnSave.Text = "Ghi nhận";
			this.btnSave.UseVisualStyleBackColor = true;
			this.btnSave.Click += new EventHandler(this.btnSave_Click);
			base.AutoScaleDimensions = new SizeF(7f, 15f);
			//base.AutoScaleMode = AutoScaleMode.Font;
			this.BackColor = Color.White;
			base.ClientSize = new Size(399, 427);
			base.Controls.Add(this.btnSave);
			base.Controls.Add(this.grB2);
			base.Controls.Add(this.grB1);
			base.Controls.Add(this.label3);
			this.Font = new Font("Arial", 9f, FontStyle.Regular, GraphicsUnit.Point, 163);
			//base.Icon = (System.Drawing.Icon)componentResourceManager.GetObject("$this.Icon");
			base.Name = "frmAppOptionMain";
			base.StartPosition = FormStartPosition.CenterScreen;
			this.Text = "Tuỳ biến giao diện";
			base.Load += new EventHandler(this.frmAppOptionMain_Load);
			this.grB1.ResumeLayout(false);
			this.grB1.PerformLayout();
			this.grB2.ResumeLayout(false);
			this.grB2.PerformLayout();
			base.ResumeLayout(false);
			base.PerformLayout();
		}
		public frmAppOptionMain()
		{
			this.InitializeComponent();
		}
		private void btnSave_Click(object sender, EventArgs e)
		{
			try
			{
				RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("Software\\TVSGPP", true);
				if (this.grB1.Enabled)
				{
					registryKey.SetValue("OppLeftMenu", this.ckbOppLeftMenu.Checked.ToString());
				}
				else
				{
					registryKey.SetValue("TsbRetailDoctor", this.cbkRetailDoctor.Checked.ToString());
					registryKey.SetValue("TsbRetail", this.cbkRetail.Checked.ToString());
					registryKey.SetValue("TsbOutput", this.cbkOutput.Checked.ToString());
					registryKey.SetValue("TsbInput", this.cbkInput.Checked.ToString());
					registryKey.SetValue("TsbBill", this.cbkBill.Checked.ToString());
					registryKey.SetValue("TsbBalancer", this.cbkBalancer.Checked.ToString());
					registryKey.SetValue("TsbExpire", this.cbkExpire.Checked.ToString());
					registryKey.SetValue("TsbOutputDelete", this.cbkOutputDelete.Checked.ToString());
				}
				registryKey.Close();
				MessageBox.Show("Dữ liệu đã được cập nhật vào hệ thống!", "Thông báo", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
			}
			catch (Exception ex)
			{
				MessageBox.Show(ex.Message);
			}
		}
		private void frmAppOptionMain_Load(object sender, EventArgs e)
		{
			try
			{
				RegistryKey registryKey = Registry.CurrentUser.OpenSubKey("Software\\TVSGPP", true);
				if (this.grB1.Enabled)
				{
					this.ckbOppLeftMenu.Checked = bool.Parse(registryKey.GetValue("OppLeftMenu").ToString());
				}
				else
				{
					this.cbkRetailDoctor.Checked = bool.Parse(registryKey.GetValue("TsbRetailDoctor").ToString());
					this.cbkRetail.Checked = bool.Parse(registryKey.GetValue("TsbRetail").ToString());
					this.cbkOutput.Checked = bool.Parse(registryKey.GetValue("TsbOutput").ToString());
					this.cbkInput.Checked = bool.Parse(registryKey.GetValue("TsbInput").ToString());
					this.cbkBill.Checked = bool.Parse(registryKey.GetValue("TsbBill").ToString());
					this.cbkBalancer.Checked = bool.Parse(registryKey.GetValue("TsbBalancer").ToString());
					this.cbkExpire.Checked = bool.Parse(registryKey.GetValue("TsbExpire").ToString());
					this.cbkOutputDelete.Checked = bool.Parse(registryKey.GetValue("TsbOutputDelete").ToString());
				}
				registryKey.Close();
			}
			catch
			{
			}
		}
	}
}
